<form>
	<div class="x-list-title">
	<table width="100%" border="0" height="100%">
	<tr>
		<td align="left">
			<h2>Danh sách người dùng</h2>
		</td>
		<td align="right">	
			<div class="x-list-options">
			<a href="#Admin/User/Add" class="x-button x-button-add">Người dùng mới</a>
			</div>
		</td>
	</tr>
	</table>	
	</div>
	
	<table width="100%" class="x-list" >
		<tr>
			<th align="center" width="25">TT</th>
			<th width="150">
				<?php show_order_link('Tài khoản','username','#Admin/User',$vars) ;?>
			</th>
			<th>
				<?php show_order_link('Hồ sơ nhân sự','name','#Admin/User',$vars) ;?>
			</th>
			<th width="150">
				<?php show_order_link('Nhóm','group_id','#Admin/User',$vars) ;?>
			</th>				
			<th width="150">
				<?php show_order_link('Phòng ban','deparment_id','#Admin/User',$vars) ;?>
			</th>				
			<th width="140"><?php show_order_link('Ngày tạo','date_created','#Admin/User',$vars) ;?></th>
			
			<th width="25" colspan="2">Tác vụ</th>
		</tr>
		<?php $users = $this->get('users');?>
		<?php if( count($users) == 0 ):?>
			<tr><td colspan='8' class='page'>
				<div class='x-date'>Không có người dùng nào được tạo</div>
			</td></tr>
		<?php else: ?>
		<?php foreach( $users as $k => $a ):?>
			<tr>
				<td align="center">
					<?php _e($k+1);?>
				</td>
				<td align="center">
					<a href="#User/Info?ID=<?php _e($a['ID']);?>" class="username"<?php if( $a['is_admin']=='yes') _e(" style='color:red!important'");?>><?php _e($a['username']);?></a>
				</td>
				<td>
					<a href="#Personnel/Index/View?ID=<?php _e($a['personnel_id']);?>"><?php _e($a['personnel_name']);?></a>
				</td>
				<td align="center">
					<?php _e($a['group_title']);?>
				</td>
				<td align="center">
					<?php _e($a['department_title']);?>
				</td>
				<td align="center">
					<?php _e(show_date(DATE_FORMAT,$a['date_created']));?>
				</td>
				<td width="25" align="center">
					<a href="#Admin/User/Edit?ID=<?php _e($a['ID']);?>" class="x-edit"></a>
				</td>
				<td width="25" align="center">
					<?php if( $a['is_admin'] == 'no' ):?>
					<a onclick="module_delete('<?php _baseUrl();?>/Admin/User/Delete?ID=<?php _e($a['ID']);?>')" class="x-delete"></a>
					<?php else:?>
					<a class="x-nodelete"></a>
					<?php endif;?>
				</td>
			</tr>
		<?php endforeach;?>
		<tr>
			<td colspan="8" class="page">
				<div class="x-page">
					<?php $this->e("page");?>
				</div>		
			</td>
		</tr>
		<?php endif;?>
	</table>
</form>
